package com.ysm.smfu.utils;

import com.ysm.smfu.contans.SpKey;

/**
 * Created by Administrator on 2016/10/17.
 * 修改String格式
 */
public class StringUtil {
    public static String getPhone(String phoneNumber) {
        StringBuffer sb = new StringBuffer();
        if (phoneNumber.matches(SpKey.NUMREGEX)) {
            for (int i = 0; i < phoneNumber.length(); i++) {
                if (i == 3 || i == 6) {
                    sb.append(" ");
                }
                sb.append(phoneNumber.charAt(i));
            }
            return sb.toString();
        } else {
            return null;
        }
    }
}
